package com.xnyzc.lhy.order.controller.sys.vehicle;


import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.order.entity.vehicle.OaSysVehicleMaintain;
import com.xnyzc.lhy.order.service.system.IOaSysVehicleMaintainService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 车辆保养表 前端控制器
 * </p>
 *
 * @author lhy@xnyzc.com
 * @since 2019-07-24
 */
@RestController
@RequestMapping("/sys/vehicle/oaSysVehicleMaintain")
public class OaSysVehicleMaintainController {

    @Autowired
    private IOaSysVehicleMaintainService maintainService;

    @ApiOperation(value = "车辆保养列表", notes = "车辆保养列表")
    @GetMapping(value = "/vehicleMaintainList")
    public Rv vehicleMaintainList(
            @ApiParam(name = "vehicleId", value = "司机ID") Long vehicleId,
            @ApiParam(name = "page", value = "当前页") Integer page,
            @ApiParam(name = "limit", value = "每页显示数量") Integer limit) {
        return maintainService.vehicleMaintainList(vehicleId, page, limit);
    }

    @ApiOperation(value = "车辆保养详情", notes = "车辆保养详情")
    @GetMapping(value = "/vehicleList")
    public Rv getVehicleMaintain(
            @ApiParam(name = "maintainId", value = "保养ID") Long maintainId
    ) {
        return maintainService.getVehicleMaintain(maintainId);
    }

    @ApiOperation(value = "添加保养信息", notes = "添加保养信息")
    @PostMapping(value = "/addVehicleMaintain")
    public Rv addVehicleMaintain(
            @ApiParam(name = "vehicleMaintain", value = "保养信息实体类")OaSysVehicleMaintain vehicleMaintain
            ){

        return maintainService.addVehicleMaintain(vehicleMaintain);
    }


}
